38b05caa87cd8efc2a1c85f4dfc789a699eca380,opennms-services/src/main/java/org/opennms/netmgt/config/XmlrpcdConfigFactory.java,XmlrpcdConfigFactory,getEventList,#ExternalServers#,269

Before Change


     */
    public synchronized ArrayList<SubscribedEvent> getEventList(ExternalServers server) throws ValidationException {
        // get names of event subscriptions from server
        List<String> serverSubs = server.getServerSubscriptionCollection();

        // get event lists from names
        ArrayList<SubscribedEvent> allEventsList = new ArrayList<SubscribedEvent>();
        for (int i = 0; i < serverSubs.size(); i++) {
            String name = serverSubs.get(i);

            List<Subscription> subscriptions = m_config.getSubscriptionCollection();

            boolean foundSubscription = false;

            for (int j = 0; j < subscriptions.size(); j++) {
                Subscription sub = subscriptions.get(j);
                if (sub.getName().equals(name)) {
                    allEventsList.addAll(sub.getSubscribedEventCollection());
                    foundSubscription = true;
                    break;
                }
            }

            if (!foundSubscription) {
                // oops -- a serverSubscription element referenced a 
                //  subscription element that doesn't exist
                
                Category log = ThreadCategory.getInstance(getClass());
                log.error("serverSubscription element " + name + 
                            " references a subscription that does not exist");
                throw new ValidationException("serverSubscription element " +

After Change


     */
    public synchronized List<SubscribedEvent> getEventList(ExternalServers server) throws ValidationException {
        List<SubscribedEvent> allEventsList = new ArrayList<SubscribedEvent>();
        for (String name : server.getServerSubscriptionCollection()) {
            List<Subscription> subscriptions = m_config.getSubscriptionCollection();

            boolean foundSubscription = false;
            for (Subscription sub : subscriptions) {
                if (sub.getName().equals(name)) {
                    allEventsList.addAll(sub.getSubscribedEventCollection());
                    foundSubscription = true;
                    break;
                }
            }

            if (!foundSubscription) {
                /*
                 * Oops -- a serverSubscription element referenced a 
                 * subscription element that doesn't exist.
                 */
                log().error("serverSubscription element " + name + 
                            " references a subscription that does not exist");
                throw new ValidationException("serverSubscription element " +
                    name + " references a subscription that does not exist");